package com.java.jetpackdemo.room

import androidx.lifecycle.LiveData
import androidx.room.*

@Dao
interface UserDao {

    //ORDER BY ID DESC 根据id降序排序
    @Query("SELECT * FROM UserBean ORDER BY ID DESC")
    fun getAll(): LiveData<MutableList<UserBean>>


    //    vararg  代表可以传多个user
    @Insert
    fun insertUser(vararg user: UserBean)

    @Delete
    fun deleteUser(vararg user: UserBean)


    @Query("DELETE FROM UserBean")
    fun deleteAll()

    @Update
    fun updateUser(vararg user: UserBean)


}